package com.fy.controll;

import com.fy.model.User;
import com.fy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by Administrator on 2020/10/28 0028.
 */
@Controller
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("/login")
    public String getUserByParam(User user){
        System.out.println(user.getName()+","+user.getPassword());
        //控制层->业务层-dao
        int addCount = userService.getUserByParam(user);
        String resutLink = "login";//跳转页面
        System.err.println("addCount:"+addCount);
        if(addCount>0){
            System.out.println("登录成功");
            resutLink = "redirect:shopList";//请求转发，重定向
        }
        return resutLink;
    }
}
